﻿@model CampWeek5__Book_Project_.Models.AuthorVM
@{
    ViewBag.Title = "AuthorDetail";
}

<div class="row container-fluid ">
    <div class="container col-sm-6 col-lg-5">
        <img class="img-responsive  dg-authorDetailImage" src="@Model.AuthorImg" />
    </div>
    <div>
        <a href="/Admin/AdminEditAuthor/@Model.Id" class="btn btn-warning">Edit</a>   <a href="/Admin/AdminDeleteAuthor/@Model.Id" class="btn btn-danger">Delete</a>
        <a href="/Admin/CreateBook/@Model.Id" class="btn btn-success">Add Book by this Author</a>
    </div>
    <div class="col-sm-6 col-lg-7" style="float:right;">
        <h2><strong>@Model.AuthorName</strong></h2>
        <h4><strong>From:</strong>  @Model.AuthorCountry</h4>
        <p><strong>Born:</strong>  @Model.DateOfBirth.ToString("MM/dd/yyyy")</p>
        @if (@Model.DateOfDeath.HasValue == false)
        {
            <p><strong>Died:</strong> <i> na</i></p>
        }
        else
        {
            <p><strong>Died:</strong>  @Model.DateOfDeath.Value.ToString("MM/dd/yyyy")</p>
        }
        @if (@Model.Tags.Count == 0)
        {
            <p><strong>Genres:</strong> <i> ***no genres have been assigned to this author</i></p>
        }
        else
        {
            <p><strong>Genres:</strong> @string.Join(", ", Model.Tags)</p>
        }
        <p>@Model.AuthorBio</p>
    </div>
</div>
<div class="row container">
    <h3>Books</h3>
    @foreach (var b in Model.Books)
    { 
        
        <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
            <a style="color:black;" href="/Details/BookDetail/@b.ISBN">
                <img id="fp" src="@b.BookImg" />
                <br />
                @b.Title
                <br />
            </a>
        </div>
    }
</div>
    



